<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../jsp/commons/taglibs.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>重置密码</title>
<meta name="viewport" content="device-width,initial-scale=1.0">


<%@include file="../jsp/commons/meta.jsp"%>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css"
	rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="${ctx }/javascript/md5.js"></script>

<style type="text/css">
#big {
	width: auto;
	height: auto;
}
</style>


</head>

<body style="font-family:'楷体'; font-size:24px;background: #DADADA;">
	<div id="big" align="center">
		<div class="container-fluid"
			style="background-color:#438EB8;height:auto; width: auto;">
			<div
				style="font-size:22px;color:#ffffff; padding-top:5px; width: auto;height: auto;">
				<span>用户找回密码</span>
			</div>
		</div>
		<form class="form-horizontal"
			action="${ctx }/wumimember/memberaction!resetPassword" name="formsubmit"
			id="formsubmit" method="post" role="form">
			<table width="203" height="256" border="0" style="margin-top:80px;">
				<tr>
					<td width="193" height="57" style="text-align:center;"><span
						style="font-size: 26px;">重置密码</span>
					</td>
				</tr>
				<tr>
					<td height="42"><div class="form-group">
							<div class="col-sm-7">
								<input type="password" name="newPsw" class="form-control"
									id="newpass" placeholder="请输入新密码" onblur="checkNew()">
							</div>
						</div></td>

				</tr>
				<tr>

					<td height="37"><div class="form-group">
							<div class="col-sm-7">
								<input type="password" class="form-control" id="confimPass"
									placeholder="请输入确认密码" onblur="checkConfimPass()">
							</div>
						</div></td>
				</tr>
				<tr>
					<td height="57" style="text-align: center;"><input type="text"
						name="mobile" value="${mobile }" style="display: none;">
						<div id="Message">${message}</div></td>
				</tr>
				<tr>
					<td height="49" style="text-align: center;">
						<button type="button" class="btn btn-primary" onclick="OnSubmit()">提交</button></td>
				</tr>
			</table>


		</form>

		<div style="width: auto;height: auto;margin-top: 200px;">
			<c:import url="/jsp/commons/footer.jsp"></c:import>
		</div>
	</div>

</body>

<script type="text/javascript">
	function checkNew() {
		//使用JS判断为空
		var New = $("#newpass").val();
		if (New.length == 0) {
			$("#Message").html("<span style='color: red;'>请输入新密码</span>");
		} else {
			$("#Message").html("");
		}

	}

	function checkConfimPass() {
		var ConfimPass = $("#confimPass").val();
		var New = $("#newpass").val();

		if (ConfimPass.length == 0) {
			$("#Message").html("<span style='color: red;'>请输入确认密码</span>");
			return false;
		} else {

			if (ConfimPass != New) {
				$("#Message").html("<span style='color: red;'>输入密码不一致</span>");
				return false;
			} else {
				$("#Message").html("");
			}
		}

	}

	function OnSubmit() {
		var New = $("#newpass").val();
		var ConfimPass = $("#confimPass").val();

		if (New.length == 0) {
			$("#Message").html("<span style='color: red;'>请输入新密码</span>");
			return false;
		} else {
			$("#Message").html("");
		}

		if (ConfimPass.length == 0) {
			$("#Message").html("<span style='color: red;'>请输入确认密码</span>");
			return false;
		} else {

			$("#Message").html("");
		}

		if (ConfimPass != New) {
			$("#Message").html("<span style='color: red;'>输入密码不一致</span>");
			return false;
		} else {
			$("#Message").html("");
			$("#newpass").val(faultylabs.MD5($("#newpass").val()));
			$("#confimPass").val(faultylabs.MD5($("#confimPass").val()));
			formsubmit.submit();

		}

	}
</script>
</html>
